package com.darling.danotebackend.api.imagesearch;

import com.darling.danotebackend.api.imagesearch.model.ImageSearchResult;
import com.darling.danotebackend.api.imagesearch.sub.GetImageFirstUrlApi;
import com.darling.danotebackend.api.imagesearch.sub.GetImageListApi;
import com.darling.danotebackend.api.imagesearch.sub.GetImagePageUrlApi;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * 门面模式 图片搜索接口
 *
 * @author wzd
 */
@Slf4j
public class ImageSearchApiFacade {

    /**
     * 搜索图片
     *
     * @param imageUrl 图片地址
     * @return List<ImageSearchResult>
     */
    public static List<ImageSearchResult> searchImage(String imageUrl) {
        String imagePageUrl = GetImagePageUrlApi.getImagePageUrl(imageUrl);
        String imageFirstUrl = GetImageFirstUrlApi.getImageFirstUrl(imagePageUrl);
        return GetImageListApi.getImageList(imageFirstUrl);
    }


    // public static void main(String[] args) {
    //     String url = "https://da-note-1342043975.cos.ap-shanghai.myqcloud.com//avatar/2/2025-07-18_hi7Jt9YMj1jC3kDZ.jpg";
    //     List<ImageSearchResult> imageSearchResults = searchImage(url);
    //     System.out.println("imageSearchResults = " + imageSearchResults);
    // }


}
